package com.bdjk.bdmw.InfoGath.business.heremi.vo;

import java.io.Serializable;
import java.text.ParseException;
import java.util.Date;

import com.alibaba.druid.util.StringUtils;
import com.bdjk.bdmw.InfoGath.business.heremi.model.HereMiPositionModel;
import com.bdjk.bdmw.InfoGath.common.constants.InfoGathConstants;
import com.bdjk.bdmw.InfoGath.common.vo.BaseVO;

public class HereMiPositionVO extends BaseVO implements Serializable {

	private static final long serialVersionUID = 509048313868603878L;
	// id
	private String id;
	// 设备唯一标识
	private String terIdent;
	// 对应协议编码
	private String proCode;
	// 终端发送时间
	private String sendTime;
	// 是否定位
	private String isEchoLocation;
	// 经度
	private String longitude;
	// 纬度
	private String latitude;
	// 速度
	private String speed;
	// 方向
	private String direction;
	// 海拔
	private String altitude;
	// 卫星数量
	private String satelliteNum;
	// gsm型号强度
	private String gsmSignStrength;
	// 电量
	private String electricity;
	// 记步数
	private String stepNum;
	// 翻滚数
	private String rollNum;
	// 终端状态
	// 01：sos报警   02：蓝牙端口报警   04：出围栏报警   08：低电量报警   10：取手环报警
	private String terStatus;
	// 基站个数
	private String baseStationNum;
	// 连接基站GSM时延（不太懂这个属性含义）
	private String connBs;
	// MCC国家码
	private String mccCode;
	// MNC网号
	private String mncCode;
	// 连接基站区域号
	private String areaCode;
	// 连接基站编号
	private String connBsCode;
	// 连接基站信号强度
	private String connBsStrength;
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getLongitude() {
		return longitude;
	}
	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}
	public String getLatitude() {
		return latitude;
	}
	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}
	public String getSpeed() {
		return speed;
	}
	public void setSpeed(String speed) {
		this.speed = speed;
	}
	public String getDirection() {
		return direction;
	}
	public void setDirection(String direction) {
		this.direction = direction;
	}
	public String getAltitude() {
		return altitude;
	}
	public void setAltitude(String altitude) {
		this.altitude = altitude;
	}

	public String getTerIdent() {
		return terIdent;
	}
	public void setTerIdent(String terIdent) {
		this.terIdent = terIdent;
	}
	public String getProCode() {
		return proCode;
	}
	public void setProCode(String proCode) {
		this.proCode = proCode;
	}
	public String getSendTime() {
		return sendTime;
	}
	public void setSendTime(String sendTime) {
		this.sendTime = sendTime;
	}
	public String getIsEchoLocation() {
		return isEchoLocation;
	}
	public void setIsEchoLocation(String isEchoLocation) {
		this.isEchoLocation = isEchoLocation;
	}
	public String getSatelliteNum() {
		return satelliteNum;
	}
	public void setSatelliteNum(String satelliteNum) {
		this.satelliteNum = satelliteNum;
	}
	public String getGsmSignStrength() {
		return gsmSignStrength;
	}
	public void setGsmSignStrength(String gsmSignStrength) {
		this.gsmSignStrength = gsmSignStrength;
	}
	public String getElectricity() {
		return electricity;
	}
	public void setElectricity(String electricity) {
		this.electricity = electricity;
	}
	public String getStepNum() {
		return stepNum;
	}
	public void setStepNum(String stepNum) {
		this.stepNum = stepNum;
	}
	public String getRollNum() {
		return rollNum;
	}
	public void setRollNum(String rollNum) {
		this.rollNum = rollNum;
	}
	public String getTerStatus() {
		return terStatus;
	}
	public void setTerStatus(String terStatus) {
		this.terStatus = terStatus;
	}
	public String getBaseStationNum() {
		return baseStationNum;
	}
	public void setBaseStationNum(String baseStationNum) {
		this.baseStationNum = baseStationNum;
	}
	public String getConnBs() {
		return connBs;
	}
	public void setConnBs(String connBs) {
		this.connBs = connBs;
	}
	public String getMccCode() {
		return mccCode;
	}
	public void setMccCode(String mccCode) {
		this.mccCode = mccCode;
	}
	public String getMncCode() {
		return mncCode;
	}
	public void setMncCode(String mncCode) {
		this.mncCode = mncCode;
	}
	public String getAreaCode() {
		return areaCode;
	}
	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}
	public String getConnBsCode() {
		return connBsCode;
	}
	public void setConnBsCode(String connBsCode) {
		this.connBsCode = connBsCode;
	}
	public String getConnBsStrength() {
		return connBsStrength;
	}
	public void setConnBsStrength(String connBsStrength) {
		this.connBsStrength = connBsStrength;
	}
	public HereMiPositionModel vo2Model() throws ParseException{
		HereMiPositionModel model = new HereMiPositionModel();
		if(!StringUtils.isEmpty(this.id)){
			model.setId(Integer.valueOf(this.id));
		}
		if(!StringUtils.isEmpty(this.altitude)){
			model.setAltitude(Double.valueOf(altitude));
		}
		model.setAreaCode(this.areaCode);
		if(!StringUtils.isEmpty(this.baseStationNum)){
			model.setBaseStationNum(Integer.valueOf(this.baseStationNum));
		}
		model.setConnBs(this.connBs);
		model.setConnBsCode(connBsCode);
		if(!StringUtils.isEmpty(this.connBsStrength)){
			model.setConnBsStrength(Double.valueOf(this.connBsStrength));
		}
		if(!StringUtils.isEmpty(this.direction)){
			model.setDirection(Double.valueOf(this.direction));
		}
		
		if(!StringUtils.isEmpty(this.electricity)){
			model.setElectricity(Integer.valueOf(this.electricity));
		}
		if(!StringUtils.isEmpty(this.gsmSignStrength)){
			model.setGsmSignStrength(Double.valueOf(gsmSignStrength));
		}
		
		/*if(!StringUtils.isEmpty(this.isEchoLocation)){
			model.setIsEchoLocation(Integer.valueOf(isEchoLocation));
		}*/
		model.setIsEchoLocation(this.isEchoLocation);
		model.setLatitude(this.latitude);
		model.setLongitude(this.longitude);
		model.setMccCode(this.mccCode);
		model.setMncCode(this.mncCode);
		model.setProCode(this.proCode);
		if(!StringUtils.isEmpty(this.rollNum)){
			model.setRollNum(Integer.valueOf(this.rollNum));
		}
		if(!StringUtils.isEmpty(this.satelliteNum)){
			model.setSatelliteNum(Integer.valueOf(satelliteNum));
		}
		
		if(!StringUtils.isEmpty(this.sendTime)){
			model.setSendTime(InfoGathConstants.SDF.parse(this.sendTime));
		}
		/*
		if(!StringUtils.isEmpty(this.sendTime)){
			model.setSendTime(InfoGathConstants.SDF.parse("2002-10-8 15:30:22"));
		}*/
		if(!StringUtils.isEmpty(this.speed)){
			model.setSpeed(Double.valueOf(this.speed));
		}
		
		if(!StringUtils.isEmpty(this.stepNum)){
			model.setStepNum(Integer.valueOf(stepNum));
		}
		model.setTerIdent(this.terIdent);
		model.setTerStatus(this.terStatus);
		if(model.getUpdateTime() == null){
			model.setUpdateTime(new Date(System.currentTimeMillis()));
		}
		return  model;
	}
	
}
